#!/bin/bash
# By tzdtwsj.


check_depends() {
status=1
echo "依赖检查中"
for i in $@; do
if test "$(command -v $i)" = "";then
	echo "找不到命令$i"
	status=0
fi
done
if test "$status" = "0"; then
	echo "请安装完这些依赖后再继续"
	exit 1
fi
}

check_depends curl rm

download_url="https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest/downloads/spigot"

echo 下载Geyser spigot插件版中
mkdir -p plugins
curl -L "$download_url" -o plugins/Geyser-Spigot.jar
if test "$?" != "0"; then
	echo "服务端下载失败"
	rm -rf plugins/Geyser-Spigot.jar
	exit 1
fi
echo "下载成功！"
